﻿using BBCore.Core.Models.Samples;
using FreeSql.DataAnnotations;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BBCore.Core.Models.BaseModels
{
    /// <summary>
    /// 主从表主表关联字段（含从表集合）
    /// </summary>
    /// <typeparam name="TKey">主键类型（如int, guid）</typeparam>
    /// <typeparam name="TDetail">从表类型，需实现IDetailTable<TKey></typeparam>
    public interface IMasterTable<TKey, TDetail> where TDetail : IDetailTable<TKey>
    {
        /// <summary>
        /// 主表关联字段HEAD_ID
        /// </summary>
        TKey HEAD_ID { get; set; }

        /// <summary>
        /// 从表集合导航属性
        /// </summary>
        [Navigate(nameof(IDetailTable<TKey>.BODY_ID))]
        List<TDetail>? Details { get; set; }
    }
}
